package com.example.eduservice.controller.front;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.eduservice.entity.EduCourse;
import com.example.eduservice.entity.EduTeacher;
import com.example.eduservice.service.EduCourseService;
import com.example.eduservice.service.EduTeacherService;
import com.example.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
//@CrossOrigin //跨域
@RestController
@RequestMapping("/eduservice/indexFront")
public class IndexFrontController {
    @Autowired
    private EduCourseService courseService;


    @Autowired
    private EduTeacherService teacherService;
    @GetMapping("/index")
    public R index(){
        //前八个热门课程

        List<EduCourse> courseList=courseService.selectCourseList();

        //前四名讲师
   
        List<EduTeacher> teacherList=teacherService.selectTeacherList();

        return  R.ok().data("courses",courseList).data("teachers",teacherList);
    }
}
